package Others.DesignPattern.PrototypePattern.Pattern.Object1;

import lombok.Data;

@Data
public class ShallowCloneResume implements Cloneable{

    //这里lombok使用的是setWorkExperience(new ShallowWorkExperience)--这里使用new的话，不属于是克隆的效果

    private String name;
    private String sex;
    private String age;
    private String company;
    private ShallowWorkExperience shallowWorkExperience;

    public ShallowCloneResume() {
    }


    public ShallowCloneResume(String name, String sex, String age, String company, ShallowWorkExperience shallowWorkExperience) {
        this.name = name;
        this.sex = sex;
        this.age = age;
        this.company = company;
        this.shallowWorkExperience = shallowWorkExperience;
    }

    public void setShallowWorkExperience(String timeArea){
        this.getShallowWorkExperience().setTimeArea(timeArea);
    }

    public void show(){
        System.out.println("姓名：" + name + "  性别：" + sex + "  年龄：" + age + "  工作年限：" + shallowWorkExperience.getTimeArea() + "  工作经历：" + company);
    }

    @Override
    public Object clone() throws CloneNotSupportedException {
        return super.clone();
    }

}
